﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MasterPages/Core.Master"
    CodeBehind="AssociationBankDeposite.aspx.cs" Inherits="Pap.Web.Modules.Loan.Views.AssociationBankDeposite"
    meta:resourcekey="PageResource1" %>

<%@ Register Src="../../Shared/Views/InsertAttchments.ascx" TagName="InsertAttchments"
    TagPrefix="Attachment" %>
<asp:Content runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
    <ext:Store runat="server" ID="storeProjects" AutoLoad="True" IDMode="Legacy" meta:resourcekey="storeProjectsResource1"
        SerializationMode="Simple">
        <Reader>
            <ext:JsonReader ReaderID="ProjectID">
                <Fields>
                    <ext:RecordField Name="ProjectID" />
                    <ext:RecordField Name="ProjectName" />
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <ext:Store runat="server" ID="storePaidReciepts" AutoLoad="True" IDMode="Legacy"
        meta:resourcekey="storePaidRecieptsResource1" SerializationMode="Simple">
        <Reader>
            <ext:JsonReader ReaderID="ReceiptID">
                <Fields>
                    <ext:RecordField Name="ReceiptNumber" />
                    <ext:RecordField Name="ReceiptType" />
                    <ext:RecordField Name="ReceiptDate" />
                    <ext:RecordField Name="ReceiptAmount" />
                    <ext:RecordField Name="ReceiptID" />
                </Fields>
            </ext:JsonReader>
        </Reader>
        <SortInfo Direction="ASC"></SortInfo>
    </ext:Store>
    <ext:Store runat="server" ID="storeDepositReciepts" AutoLoad="True" IDMode="Legacy"
        meta:resourcekey="storeDepositRecieptsResource1" SerializationMode="Simple">
        <Reader>
            <ext:JsonReader ReaderID="ReceiptID">
                <Fields>
                    <ext:RecordField Name="ReceiptNumber" />
                    <ext:RecordField Name="ReceiptType" />
                    <ext:RecordField Name="ReceiptDate" />
                    <ext:RecordField Name="ReceiptAmount" />
                    <ext:RecordField Name="ReceiptID" />
                </Fields>
            </ext:JsonReader>
        </Reader>
        <SortInfo Direction="ASC"></SortInfo>
    </ext:Store>
    <ext:FitLayout runat="server" IDMode="Legacy" meta:resourcekey="FitLayoutResource1">
        <ext:FormPanel runat="server" ID="panelMain" AutoScroll="true" Title="Association Bank Deposite"
            meta:resourcekey="panelMainResource1" BodyStyle="padding:5px;" >
            <Body>
                <ext:FormLayout runat="server" ElementStyle="" ItemCls="" meta:resourcekey="FormLayoutResource1">
                    <ext:Anchor Horizontal="95%">
                        <ext:TextField runat="server" ID="txtAssociationName" FieldLabel="AssociationName"
                            Disabled="True" AllowBlank="False" meta:resourcekey="txtAssociationNameResource1" />
                    </ext:Anchor>
                    <ext:Anchor Horizontal="95%">
                        <ext:ComboBox ValueField="ProjectID" FieldLabel="Project" DisplayField="ProjectName"
                            runat="server" ID="cmbProjects" meta:resourcekey="cmbProjectsResource" StoreID="storeProjects"
                            Editable="False" AllowBlank="False" TriggerAction="All">
                            <AjaxEvents>
                                <Select OnEvent="CmbProjects_Selected">
                                    <EventMask ShowMask="True" />
                                </Select>
                            </AjaxEvents>
                        </ext:ComboBox>
                    </ext:Anchor>
                    <ext:Anchor Horizontal="95%">
                        <ext:TextField runat="server" ID="txtBalanceBeforeDeposit" FieldLabel="BalanceBeforeDeposit"
                            Disabled="True" AllowBlank="False" meta:resourcekey="txtBalanceBeforeDepositResource1"
                            Text="" />
                    </ext:Anchor>
                    <ext:Anchor Horizontal="95%">
                        <ext:DateField runat="server" ID="dateDepositeDate" FieldLabel="DepositeDate" AllowBlank="False"
                            MaxDate="" meta:resourcekey="dateDepositeDateResource1" MinDate="" SelectedDate="" />
                    </ext:Anchor>
                    <ext:Anchor Horizontal="95%">
                        <ext:TextField runat="server" meta:resourcekey="txtApplicationNumberResource" FieldLabel="ApplicationNumber"
                            ID="txtApplicationNumber" Regex="^[0-9A-z]+$" AllowNegative="false" AllowBlank="False"
                            MaxLength="50" Text="">
                        </ext:TextField>
                    </ext:Anchor>
                    <ext:Anchor Horizontal="95%">
                        <ext:TextArea runat="server" ID="txtNotes" MaxLength="8000" Regex="^[0-9A-zء-ي' ']+$"
                            FieldLabel="Notes" meta:resourcekey="txtNotesResource1" Text="" />
                    </ext:Anchor>
                    <ext:Anchor Horizontal="95%">
                        <ext:Panel ID="Panel1" runat="server" AutoHeight="True" Frame="true" StyleSpec="margin-top:20px;">
                            <Body>
                                <ext:ColumnLayout runat="server" FitHeight="true" Split="true">
                                    <ext:LayoutColumn ColumnWidth="0.5">
                                        <ext:GridPanel runat="server" ID="gridDepositReceipts" StoreID="storeDepositReciepts"
                                            Title="DepositeReceipts" meta:resourcekey="gridDepositReceiptsResource1">
                                            <ColumnModel>
                                                <Columns>
                                                    <ext:Column DataIndex="ReceiptNumber" Header="<%$ Resources:ReceiptNumber %>" Sortable="True" />
                                                    <ext:Column DataIndex="ReceiptType" Header="<%$Resources:ReceiptType %>" Sortable="True" />
                                                    <ext:Column DataIndex="ReceiptDate" Header="<%$Resources:ReceiptDate %>" Sortable="True">
                                                        <Renderer Fn="Ext.util.Format.dateRenderer('d/m/Y')" />
                                                    </ext:Column>
                                                    <ext:Column DataIndex="ReceiptAmount" Header="<%$ Resources:ReceiptAmount %>" Sortable="True">
                                                        <Commands>
                                                            <ext:ImageCommand Icon="Delete" ToolTip-Text="<%$ Resources:TipDeleteReceipt %>"
                                                                CommandName="DeleteReceipt" IconCls="icon-delete" />
                                                        </Commands>
                                                    </ext:Column>
                                                </Columns>
                                            </ColumnModel>
                                            <AjaxEvents>
                                                <Command OnEvent="GridDepositReceipts_Command">
                                                    <ExtraParams>
                                                        <ext:Parameter Name="CommandName" Value="command" Mode="Raw" Encode="False" />
                                                        <ext:Parameter Name="ReceiptID" Value="record.data.ReceiptID" Mode="Raw" Encode="False" />
                                                    </ExtraParams>
                                                    <EventMask ShowMask="True" />
                                                </Command>
                                            </AjaxEvents>
                                        </ext:GridPanel>
                                    </ext:LayoutColumn>
                                    <ext:LayoutColumn ColumnWidth="0.5">
                                        <ext:GridPanel runat="server" ID="gridPaidReciepts" StoreID="storePaidReciepts" Title="PaidReceipts"
                                            meta:resourcekey="gridPaidRecieptsResource1">
                                            <ColumnModel>
                                                <Columns>
                                                    <ext:Column DataIndex="ReceiptNumber" Header="<%$ Resources:ReceiptNumber %>" Sortable="True" />
                                                    <ext:Column DataIndex="ReceiptType" Header="<%$Resources:ReceiptType %>" Sortable="True" />
                                                    <ext:Column DataIndex="ReceiptDate" Header="<%$Resources:ReceiptDate %>" Sortable="True">
                                                        <Renderer Fn="Ext.util.Format.dateRenderer('d/m/Y')" />
                                                    </ext:Column>
                                                    <ext:Column DataIndex="ReceiptAmount" Header="<%$ Resources:ReceiptAmount %>" Sortable="True">
                                                        <Commands>
                                                            <ext:ImageCommand Icon="Add" ToolTip-Text="<%$ Resources:TipAddReceipt %>" CommandName="AddReceipt"
                                                                IconCls="icon-add" />
                                                        </Commands>
                                                    </ext:Column>
                                                </Columns>
                                            </ColumnModel>
                                            <AjaxEvents>
                                                <Command OnEvent="GridPaidReciepts_Command">
                                                    <ExtraParams>
                                                        <ext:Parameter Name="CommandName" Value="command" Mode="Raw" Encode="False" />
                                                        <ext:Parameter Name="ReceiptID" Value="record.data.ReceiptID" Mode="Raw" Encode="False" />
                                                    </ExtraParams>
                                                    <EventMask ShowMask="True" />
                                                </Command>
                                            </AjaxEvents>
                                        </ext:GridPanel>
                                    </ext:LayoutColumn>
                                </ext:ColumnLayout>
                            </Body>
                            <BottomBar>
                                <ext:StatusBar runat="server">
                                    <Items>
                                        <ext:TextField runat="server" ID="txtdepositTotalAmount" AllowBlank="False" ReadOnly="true"
                                            FieldLabel="TotalDeposit" CausesValidation="True" meta:resourcekey="txtdepositTotalAmountResource1"
                                            Text="" Width="300" />
                                        <ext:Label runat="server" Text='<%$ Resources:txtdepositTotalAmountResource1.FieldLabel %>'>
                                        </ext:Label>
                                    </Items>
                                </ext:StatusBar>
                            </BottomBar>
                        </ext:Panel>
                    </ext:Anchor>
                    <ext:Anchor Horizontal="95%">
                        <ext:Panel runat="server" ID="panel" AutoHeight="True" meta:resourcekey="panelResource1"
                             Collapsible="true" StyleSpec="margin-top:20px;" Icon="Attach">
                            <Body>
                                <Attachment:InsertAttchments ID="InsertAttchments1" runat="server" ViewMode="Edit" />
                            </Body>
                        </ext:Panel>
                    </ext:Anchor>
                </ext:FormLayout>
            </Body>
            <BottomBar>
                <ext:StatusBar runat="server" meta:resourcekey="StatusBar1Resource1">
                    <Items>
                        <ext:Button ID="btnDeposit" runat="server" Text="Deposit" Icon="MoneyAdd" meta:resourcekey="btnDepositResource1">
                            <AjaxEvents>
                                <Click OnEvent="BtnDeposit_Clicked" Before="return #{panelMain}.getForm().isValid();">
                                    <ExtraParams>
                                        <ext:Parameter Name="gridDepositReceipts" Value="Ext.encode(#{gridDepositReceipts}.getRowsValues(false))"
                                            Mode="Raw" />
                                    </ExtraParams>
                                    <EventMask ShowMask="true" />
                                </Click>
                            </AjaxEvents>
                        </ext:Button>
                        <ext:Button runat="server" ID="btnBack" Icon="ArrowUndo" meta:resourcekey="btnBackResource">
                            <AjaxEvents>
                                <Click OnEvent="BtnBack_Clicked" ViewStateMode="Include" />
                            </AjaxEvents>
                        </ext:Button>
                    </Items>
                </ext:StatusBar>
            </BottomBar>
        </ext:FormPanel>
    </ext:FitLayout>
</asp:Content>
